Skip to content

fix: migrate UI to core 0.3.2 snapshot contract - #166

Merged
elonehoo merged 3 commits into
mainfrom
fix/core-032-contract-impact
Oct 31, 2026
Merged

elonehoo merged 3 commits into
mainfrom
fix/core-032-contract-impact

Conversation

@elonehoo

@elonehoo elonehoo commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Upgrade all 59 core catalog entries and the exact-core compatibility gate to 0.3.2, after auditing the breaking React snapshot contract in destyler/destyler#362.

  • Preserve core snapshot identity in the shared React useMachine wrapper instead of spreading it.
  • Fix Tour Basic's whole-API startup effect feedback using a stable command.
  • Fix FileUpload preview URL churn on metadata-only updates; preserve live root getters, window ownership, external helper replacement and cleanup.
  • Add three regression files (8 tests) and a detailed migration/impact note in docs/core-032-react-contract.md.

Demonstrated impact

A controlled actual-source A/B held component machines at 0.3.2 and changed only the React adapter from 0.3.1 to 0.3.2:

  • Tour: old adapter settled after 4 starts; new adapter reached the bounded 8-start feedback guard (10 effects/renders).
  • FileUpload: three same-file metadata events caused 0 extra URL allocations before vs 3 allocations/revocations after. This demonstrates churn, not a leak or measured visible flicker.

Independent review also caught a dynamic root-getter regression in the initial fix; the final implementation and regression test preserve call-time behavior. No remaining blocking local review findings.

Local verification

  • Fresh frozen pnpm 10.28.0 installation; full lint passed (0 errors, 667 warnings).
  • All four framework source type checks passed.
  • Actual repository SSR: 487 tests (React 87, Vue 168, Solid 90, Svelte 142); Vue unit: 263 tests.
  • Node 22.22.3 / React 19.3.0 final targeted run: 165 tests (8 new + 153 controlled-state + 4 environment-boundary); React SSR 87 again.
  • React 18.0.0: final 8 regressions + FileUpload SSR passed.
  • Node-floor four-framework build/pack/isolated installed consumers: 52 interaction cases, all resolved core packages verified as 0.3.2; runner unit tests 14.
  • React 18.0.0 and 19.3.0 separate packed gate: imports, Bundler/NodeNext declarations, SSR and simulated-DOM hydration/interactions passed; declaration unit tests 4.

Why draft / remaining verification

Happy DOM and SSR are not real-browser verification; browser-only controlled-state branches were not executed locally. The cloud executor's os.networkInterfaces() fails with uv_interface_addresses, including the standard Storybook build before stories compile. No workaround bypassing sandbox restrictions was used.

Please retain the draft until CI/browser gates are reviewed. Chromium/Firefox/WebKit behavior, focus/layout/a11y, browser image loading and Storybook rendering are not claimed as passed. Broad context fanout is an unmeasured profiling risk, not a claimed performance regression. No release/version publication or merge is included.

The lockfile was generated by the declared pnpm version; some existing non-core peer snapshots were re-resolved without changing their package versions/integrities. Frozen install and the above source/artifact checks passed.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Changes React subscription semantics workspace-wide via core 0.3.2; incorrect effect dependencies elsewhere could still cause extra renders or loops despite the targeted Tour/FileUpload fixes.

Overview
This PR bumps the workspace and core-compat gate to @destyler/* 0.3.2 and adapts React UI code to core’s new full-snapshot subscription model (stable snapshot references; effects must not depend on the whole connected API).

The shared useMachine wrapper no longer clones the snapshot on prop-only renders—it returns the core hook result directly so reference identity matches 0.3.2.

Tour Basic starts the tour only on mount via a ref to tour.start, avoiding a feedback loop when metadata updates re-notify subscribers. FileUpload adds a stable createFileUrl that resolves the environment at call time from a committed root getter (useInsertionEffect), and ItemPreviewImage keys its resource effect to file and createFileUrl so metadata-only machine updates do not recreate blob URLs.

New regression tests cover snapshot reference stability, tour start counts, and preview URL lifetime (including Suspense/iframe cases). Documentation adds core-032-react-contract.md and updates compatibility/node/tabs notes to 0.3.2.

Reviewed by Cursor Bugbot for commit ade2aab. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
destyler-ui Ready Ready Preview Oct 31, 2026 10:51am UTC
destyler-ui-dev Ready Ready Preview Oct 31, 2026 10:51am UTC

Copy link
Copy Markdown
Member Author

Verification update for 337b318

The first CI run caught a documentation-source compatibility issue: the Tour example's private useEvent import was rewritten as a non-public package import. The follow-up commit replaces it with public React hooks (ordered ref-update and mount effects), without exporting a new public API. Docs check was reproduced red → green locally; the existing feedback/dismissal regressions still pass.

All current GitHub workflows and both Vercel deployments have now succeeded for this head (PR merge test commit a4cbca2):

  • Main CI: Node 22.22.3 and 24: full suite 441 files / 7182 tests passed, 48 skipped. The new FileUpload 5, Tour 2 and shared-snapshot 1 tests passed in actual Chromium. Node 22 also passed framework/package checks, exact-core consumers, API/docs checks, docs browser checks and all four Storybook builds.
  • Browser accessibility smoke: four frameworks × Chromium/Firefox/WebKit, 42 browser tests plus 64 axe-policy tests passed. Axe incomplete items still require manual assessment; this is not a claim of zero accessibility issues.
  • All four packed-consumer workflows passed with real Chromium, minimum/current framework versions and dev/prod hydration/interactions. Lint passed.
  • Docs preview and dev preview are Ready.

Keeping this PR draft for your review. Storybook build success is not a manual visual review of every story; deployment Ready is not a claim of preview-page interaction QA. No merge or release was performed.

@elonehoo
elonehoo marked this pull request as ready for review October 31, 2026 10:22
@cursor

cursor Bot commented Oct 31, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 1c54f6bc-819f-4757-90e4-47fd29dc000b)

@elonehoo
elonehoo marked this pull request as draft October 31, 2026 10:40
@elonehoo
elonehoo marked this pull request as ready for review October 31, 2026 11:03
@cursor

cursor Bot commented Oct 31, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: e8bd5ef0-ff84-4f32-b707-77058aa2a4e5)

@elonehoo
elonehoo merged commit bef3cd5 into main Oct 31, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant